﻿using System.Linq;
using System.Threading;
using D3;
using NYTBD;
using NYTBD.Common;
using NYTBD.Modules;

namespace NYTBD.Modules
{
    internal static class Plato
    {


        public static int Interact(string name)
        {
            var _u = _Game.GetUnit(name);
            if (_u != null)
                return Interact(_u);
            return -1;
        }

        public static int Interact(Unit u)
        {
            if (u.Type == UnitType.Gizmo
                || u.Type == UnitType.Monster
                || u.Type == UnitType.Item)
            {

                Me.UsePower(
                    u.Type == UnitType.Monster
                        ? SNOPowerId.Axe_Operate_NPC
                        : SNOPowerId.Axe_Operate_Gizmo, u);
                return 0;
            }
            return -1;
        }

        public static int Loot(Unit u)
        {
            if (u == null) return -1;

            if (Me.UsePower(u.Type == UnitType.Monster ? SNOPowerId.Axe_Operate_NPC : SNOPowerId.Axe_Operate_Gizmo, u)) return 0; else
                return -1;
        }


        
    }
}